package com.es.common;

import javax.servlet.http.HttpServletRequest;

import com.es.main.LoginUserBeen;
import com.opensymphony.webwork.interceptor.ServletRequestAware;
import com.opensymphony.xwork.ActionSupport;

public class CommonModifyAction extends ActionSupport
implements ServletRequestAware{
	 HttpServletRequest request;
	 
	 public String execute()
     throws Exception{
		 String result = "";

		 CommonBiz cmnBiz = new CommonBiz();;
		 String itemid ="";
	
		 if (this.request.getParameter("changeitem_id") != null)
			 itemid  = this.request.getParameter("changeitem_id").toString();
		 String id = this.request.getParameter("common_id").toString();
		String code = request.getParameter("cmn_code").toString();
		String value = request.getParameter("cmn_value").toString();
		boolean res = cmnBiz.modifyCommon(code, value, id);
		if(res == true){
			 result = "success";
			 String message = "修改成功";
			 request.getSession().setAttribute("list", cmnBiz.getCommonByType(itemid));
			 this.request.setAttribute("message", message);
		}else{
			 result = "success";
			 String message = "修改失败，情重新修改";
			 request.getSession().setAttribute("list", cmnBiz.getCommonByType(itemid));
			 this.request.setAttribute("message", message);
		}
		
		 
		 return result;
	 }
	public void setServletRequest(HttpServletRequest paramHttpServletRequest) {
		// TODO Auto-generated method stub
		this.request = paramHttpServletRequest;
	}

}
